export default {
    addcart(state,palyload){
        const index = state.cartlist.findIndex((item)=>{
            return item.iid == palyload.iid
        })
        if(index == -1)
        {
            palyload.count=1
            palyload.checked=false
            state.cartlist.push(palyload)
        }
        else{
            state.cartlist[index].count++
        }
    },
    editgoodscheck(state,palyload){
        console.log(palyload)
        const good =  state.cartlist.filter((item)=>{
            return item.iid == palyload.iid
        })
        good.checked = palyload.checked
    },
    editallgoods(state,palyload){
        state.cartlist.forEach(item=> {
            item.checked = palyload
        });
    }
}